<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j"
	template="/WEB-INF/templates/template.xhtml">

	<ui:define name="breadcrumb">
		<ui:include src="breadcrumb.xhtml" />
	</ui:define>
	<ui:define name="menu">
		<ui:include src="/user/menu.xhtml" />
	</ui:define>
	<ui:define name="title">#{messages.personaFisicaSearchHeader}</ui:define>
	<ui:define name="content">
		<h:form id="form">
			<div id="form_box">
				<div id="form_left">
					<h:panelGrid columns="3">
						<h:selectBooleanCheckbox
							value="#{personaFisicaBean.input.buscarDocumento}">
							<a4j:ajax event="change" execute="@this"
								render="buscarTipoDoc,buscarNroDoc" />
						</h:selectBooleanCheckbox>
						<h:outputLabel styleClass="tarragona-search-label"
							value="#{messages.personaFisicaSearchDoc}:" />
						<h:panelGrid columns="2">
							<rich:select id="buscarTipoDoc"
								disabled="#{!personaFisicaBean.input.buscarDocumento}"
								defaultLabel="#{messages.ingresarValor}"
								value="#{personaFisicaBean.input.tipoDocumento}">
								<f:selectItems value="#{enumRefereceBean.tiposDocumentos}" />
							</rich:select>
							<h:inputText id="buscarNroDoc"
								value="#{personaFisicaBean.input.nroDoc}"
								disabled="#{!personaFisicaBean.input.buscarDocumento}">
							</h:inputText>
						</h:panelGrid>

						<h:selectBooleanCheckbox
							value="#{personaFisicaBean.input.buscarNombre}">
							<a4j:ajax event="change" execute="@this" render="buscarNombre" />
						</h:selectBooleanCheckbox>
						<h:outputLabel styleClass="tarragona-search-label"
							value="#{messages.personaFisicaSearchNombre}:" />
						<h:inputText id="buscarNombre"
							value="#{personaFisicaBean.input.nombre}"
							disabled="#{!personaFisicaBean.input.buscarNombre}">
						</h:inputText>

						<h:selectBooleanCheckbox
							value="#{personaFisicaBean.input.buscarSexo}">
							<a4j:ajax event="change" execute="@this" render="buscarSexo" />
						</h:selectBooleanCheckbox>
						<h:outputLabel styleClass="tarragona-search-label"
							value="#{messages.personaFisicaSearchSexo}:" />
						<rich:select id="buscarSexo"
							disabled="#{!personaFisicaBean.input.buscarSexo}"
							defaultLabel="#{messages.ingresarValor}"
							value="#{personaFisicaBean.input.sexo}">
							<f:selectItems value="#{enumRefereceBean.sexos}" />
						</rich:select>
					</h:panelGrid>
				</div>
				<div class="clearer"></div>
			</div>
			<div id="butons">
				<h:panelGrid columns="2" width="100%"
					columnClasses="buttons-search,buttons-create">
					<h:commandButton value="#{messages.search}"
						action="#{personaFisicaBean.search}" />

					<h:commandButton value="#{messages.personaFisicaCreate}"
						action="#{personaFisicaBean.showCreate}">
						<f:setPropertyActionListener
							value="#{facesContext.viewRoot.viewId}"
							target="#{personaFisicaBean.persistReturnView}" />
					</h:commandButton>
				</h:panelGrid>
				<h:panelGrid columns="1" />
				<rich:dataTable value="#{ejemploBean.dataModel}"
					keepSaved="true" id="resultTable" var="result" rows="20">


					<ui:include src="/WEB-INF/templates/jpaColumn.xhtml">
						<ui:param name="title" value="Apellido 1" />
                		<ui:param name="bean" value="#{ejemploBean}" />
                		<ui:param name="property" value="apellido1" />
            		</ui:include>

					<ui:include src="/WEB-INF/templates/jpaColumn.xhtml">
						<ui:param name="title" value="#{messages.personaFisicaApellido2}" />
                		<ui:param name="bean" value="#{ejemploBean}" />
                		<ui:param name="property" value="apellido2" />
            		</ui:include>

					<ui:include src="/WEB-INF/templates/jpaColumn.xhtml">
						<ui:param name="title" value="#{messages.personaFisicaPrimerNombre}" />
                		<ui:param name="bean" value="#{ejemploBean}" />
                		<ui:param name="property" value="primerNombre" />
            		</ui:include>

					<ui:include src="/WEB-INF/templates/jpaColumn.xhtml">
						<ui:param name="title" value="#{messages.personaFisicaSegundoNombre}" />
                		<ui:param name="bean" value="#{ejemploBean}" />
                		<ui:param name="property" value="segundoNombre" />
            		</ui:include>
            
					<rich:column>
						<h:commandLink action="#{personaFisicaBean.showEdit}">
							<h:graphicImage value="/resources/icons/edit.gif" alt="edit" />
							<f:setPropertyActionListener value="#{result}"
								target="#{personaFisicaBean.entity}" />
							<f:setPropertyActionListener
								value="#{facesContext.viewRoot.viewId}"
								target="#{personaFisicaBean.persistReturnView}" />
						</h:commandLink>

						<h:commandLink action="#{personaFisicaBean.showRemove}">
							<h:graphicImage value="/resources/icons/delete.gif" alt="delete" />
							<f:setPropertyActionListener value="#{result}"
								target="#{personaFisicaBean.entity}" />
							<f:setPropertyActionListener
								value="#{facesContext.viewRoot.viewId}"
								target="#{personaFisicaBean.persistReturnView}" />
						</h:commandLink>

						<h:commandLink action="#{personaFisicaBean.showRevisionList}">
							<h:graphicImage value="/resources/icons/revision.png" alt="edit" />
							<f:setPropertyActionListener value="#{result}"
								target="#{personaFisicaBean.entity}" />
							<f:setPropertyActionListener
								value="#{facesContext.viewRoot.viewId}"
								target="#{personaFisicaBean.persistReturnView}" />
						</h:commandLink>

					</rich:column>
					<f:facet name="footer">
						<rich:dataScroller id="scroller" />
					</f:facet>
				</rich:dataTable>
				<h:panelGrid columns="2" width="100%"
					columnClasses="buttons-search,buttons-create"
					rendered="#{personaFisicaBean.searchActive}">
					<h:commandButton value="#{messages.exportToExcel}"
						action="#{personaFisicaBean.exportToExcel}" />
				</h:panelGrid>
			</div>
		</h:form>
	</ui:define>
</ui:composition>
